<?php

/**
 * This is the model class for table "jumlahproduksianekausaha".
 *
 * The followings are the available columns in table 'jumlahproduksianekausaha':
 * @property string $jpau_id
 * @property integer $jpau_kec
 * @property double $jpau_jamur_log
 * @property double $jpau_jamur_kg
 * @property double $jpau_madu_stup
 * @property double $jpau_madu_liter
 * @property double $jpau_sutra
 * @property double $jpau_arang
 * @property double $jpau_walet
 * @property integer $jpau_tahun
 *
 * The followings are the available model relations:
 * @property Kecamatan $jpauKec
 */
class Jumlahproduksianekausaha extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @return Jumlahproduksianekausaha the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'jumlahproduksianekausaha';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('jpau_kec, jpau_tahun', 'numerical', 'integerOnly'=>true),
			array('jpau_jamur_log, jpau_jamur_kg, jpau_madu_stup, jpau_madu_liter, jpau_sutra, jpau_arang, jpau_walet', 'numerical'),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('jpau_id, jpau_kec, jpau_jamur_log, jpau_jamur_kg, jpau_madu_stup, jpau_madu_liter, jpau_sutra, jpau_arang, jpau_walet, jpau_tahun', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'jpauKec' => array(self::BELONGS_TO, 'Kecamatan', 'jpau_kec'),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'jpau_id' => 'Jpau',
			'jpau_kec' => 'Jpau Kec',
			'jpau_jamur_log' => 'Jpau Jamur Log',
			'jpau_jamur_kg' => 'Jpau Jamur Kg',
			'jpau_madu_stup' => 'Jpau Madu Stup',
			'jpau_madu_liter' => 'Jpau Madu Liter',
			'jpau_sutra' => 'Jpau Sutra',
			'jpau_arang' => 'Jpau Arang',
			'jpau_walet' => 'Jpau Walet',
			'jpau_tahun' => 'Jpau Tahun',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('jpau_id',$this->jpau_id,true);
		$criteria->compare('jpau_kec',$this->jpau_kec);
		$criteria->compare('jpau_jamur_log',$this->jpau_jamur_log);
		$criteria->compare('jpau_jamur_kg',$this->jpau_jamur_kg);
		$criteria->compare('jpau_madu_stup',$this->jpau_madu_stup);
		$criteria->compare('jpau_madu_liter',$this->jpau_madu_liter);
		$criteria->compare('jpau_sutra',$this->jpau_sutra);
		$criteria->compare('jpau_arang',$this->jpau_arang);
		$criteria->compare('jpau_walet',$this->jpau_walet);
		$criteria->compare('jpau_tahun',$this->jpau_tahun);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}